package org.truenewx.tnxjee.model.spec;

/**
 * 数据源定位
 *
 * @author jianglei
 */
public class DataSourceLocation extends DatabaseLocation {

    private String schema;

    public static DataSourceLocation of(DatabaseLocation database, String schema) {
        if (database != null && database.isValid()) {
            DataSourceLocation dataSource = new DataSourceLocation();
            dataSource.setHost(database.getHost());
            dataSource.setPort(database.getPort());
            dataSource.setUsername(database.getUsername());
            dataSource.setPassword(database.getPassword());
            dataSource.setSchema(schema);
            return dataSource;
        }
        return null;
    }

    public String getSchema() {
        return this.schema;
    }

    public void setSchema(String schema) {
        this.schema = schema;
    }

}
